import os

filename = 'zzz.txt'

print(filename[:2])
prefix, ext = os.path.splitext(filename)

print(prefix)  # 输出: zzz